package com.ruoyi.quartz.task;

import com.bocsoft.udp.t_del.TDel;
import com.bocsoft.udp.t_del.entity.Const;
import com.bocsoft.udp.t_del.entity.TableRule;
import com.bocsoft.udp.t_del.entity.TableTask;
import org.springframework.stereotype.Component;

@Component("tDelTask")
public class TDELExtractTableTask {

    public void extractTest()
    {
		// 初始化数据抽取组件对象，传入数据日期
		// new MySQLTDel()和new TDel()是等价的
		// 设置表配置
		TDel tDel = new TDel("20240517");
        TableRule tableRule = new TableRule();
        tableRule.setIpAddress("127.0.0.1");
        tableRule.setPort("3306");
        tableRule.setUser("root");
        tableRule.setPassword("password01!");
        tableRule.setDataBaseName("test");
        tableRule.setTabName("test");
        tableRule.setColumns("id,name,phone");
        tableRule.setAssemblyID("TU000011101"); // 组件编号
        tableRule.setPlatformID("P8"); // 14
        tableRule.setSep("\\u0001 |\\u0001"); // 15
        tableRule.setCycFlag("D"); // 16
        tableRule.setIncID("0"); // 17
        tableRule.setTableGenType("1"); // 18
        tableRule.setFileFormat(Const.FILE_FORMAT_P6);
		tableRule.setIsSplitFlag("0");
		tableRule.setMechanismID("000001");
        tableRule.setFileNamePrefix("TU000011101.00000010.TU0");
        tableRule.setFileDir("D://test//tdel/{yyyyMMdd}");
		// 抽取表数据
        TableTask tableTask = tDel.extractTableTask(tableRule);
        System.out.println(tableTask);
	}

}
